package com.jython.flink;

import org.apache.flink.api.java.utils.ParameterTool;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.JoinedStreams;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class WordCount4 {
    public static void main(String[] args) {
        int port;
        try {
            ParameterTool parameterTool = ParameterTool.fromArgs(args);
            port = parameterTool.getInt("port");
        } catch (Exception e) {
            System.out.println("没有指定port,默认为9000");
            port = 9000;
        }
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        DataStream<String> textStream= env.socketTextStream("192.168.0.180", port, "\n");
        DataStream<String> shuzi = env.fromElements("1", "2", "1", "4", "4","5","2");
        DataStream<String> zimu = env.fromElements("A", "B", "C", "D", "E");
        JoinedStreams<String, String>.Where<String> where = shuzi.join(zimu).where(x -> {
            System.out.println(x);
            return x;
        });
        try {
            env.execute("ok");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
